package ru.uskov.trainer.model;

import ru.uskov.trainer.datastore.UserIdentifyer;
import ru.uskov.trainer.datastore.impl.ContextGenerator;

public class UserAuthData {
  private final Long id;
  private final String pwd;
  private final boolean userIsCorrect;
  
  public UserAuthData(Long id, String pwd) {
    this.id = id;
    this.pwd = pwd;
    this.userIsCorrect = ContextGenerator.getInstance().userIdIsCorrect(id, pwd);
  }
  
  public UserAuthData(UserIdentifyer uid){
    this.id = uid.getId();
    this.pwd = uid.getPwd();
    this.userIsCorrect = true;
  }
  
  
  public boolean userIdIsCorrect() {
    return userIsCorrect;
  }
  
  public String getId() {
  return "" + id;  
  }
  public String getPwd() {
    return pwd;
  }
  
  @Override
  public String toString() {
    return "id="+id + ";pwd=" + pwd;
  }

}
